import dotenv from "dotenv";
dotenv.config();
type CONFIG = {
  port: number;
  logs: any;
  db_url: string;
  auth_msg: string;
  reauth_msg: string;
  auth_time: string;
  white_path: string[];
  service: string;
  qqport: number;
  user: string;
  pass: string;
  BaiDu_appid: string;
  BaiDu_key: string;
  ChatGpt: string;
};
const config: CONFIG = {
  port: Number(process.env.ALL_PORT),
  db_url: process.env.DB_URL as string,
  auth_msg: process.env.AUTH_MSG as string,
  reauth_msg: process.env.AUTH_MSG as string,
  auth_time: process.env.AUTH_TIME as string,
  service: process.env.SERVICE as string,
  qqport: Number(process.env.QQPORT),
  user: process.env.USER as string,
  pass: process.env.PASS as string,
  BaiDu_appid: process.env.BaiDu_appid as string,
  BaiDu_key: process.env.BaiDu_key as string,
  ChatGpt: process.env.ChatGpt as string,
  logs: {
    appenders: {
      cheese: {
        type: "file",
        filename: "logs/cheese.log",
        maxLogSize: 104800,
        backups: 100,
      },
      access: {
        type: "file",
        filename: "logs/access.log",
        maxLogSize: 104800,
        backups: 100,
      },
      error: {
        type: "datefile",
        filename: "logs/error",
        pattern: "yyyy-MM-dd-hh.log",
        alwaysIncludePattern: true,
        maxLogSize: 104800,
        backups: 100,
      },
    },
    categories: {
      default: {
        appenders: ["cheese"],
        level: "info",
      },
      access: {
        appenders: ["access"],
        level: "info",
      },
      error: {
        appenders: ["error"],
        level: "error",
      },
    },
    replaceConsole: true,
  },
  white_path: JSON.parse(process.env.WHITE_PATH as string) as string[],
};

export { config };
